Hello, |
Re: how to use function "hasInPlace" Sorry, it's not a text entered in a "canvas", but entered in a "field". Regards, JLacroix |
Re: how to use function "hasInPlace" Don't know about Canvases but I do understand the nuances of the manual:
hasInPlace
Declaration
void hasInPlace(DBE da, void cb(DBE el, event))
Operation
The callback function is called on one of two event types. The event type is the second argument
passed to callback function with one of the following values:
inPlaceTextFilled the text box is full and needs to be expanded
inPlaceTextChange the text box contents has been modified
void clbkCanvasEvent(DBE dbeCanvas, InPlaceEditEvent Event)
{ if (Event == inPlaceTextFilled)
{ Handle a Text Filled event in the dbeCanvas, perhaps make it taller
}
elseif (Event == inPlaceTextChange)
{ Handle the Text Change event in the dbeCanvas
}
else
{ Tell Louie he is out to lunch
}
} // end clbkCnavasEvent()
DBE dbeMyField = some sort of canvas declaration
hasInPlace(dbeMyField, clbkCanvasEvent) // Associate Events on the Canvas with the Callback
|
Re: how to use function "hasInPlace" llandale - Tue Nov 03 13:14:58 EST 2009 Don't know about Canvases but I do understand the nuances of the manual:
hasInPlace
Declaration
void hasInPlace(DBE da, void cb(DBE el, event))
Operation
The callback function is called on one of two event types. The event type is the second argument
passed to callback function with one of the following values:
inPlaceTextFilled the text box is full and needs to be expanded
inPlaceTextChange the text box contents has been modified
void clbkCanvasEvent(DBE dbeCanvas, InPlaceEditEvent Event)
{ if (Event == inPlaceTextFilled)
{ Handle a Text Filled event in the dbeCanvas, perhaps make it taller
}
elseif (Event == inPlaceTextChange)
{ Handle the Text Change event in the dbeCanvas
}
else
{ Tell Louie he is out to lunch
}
} // end clbkCnavasEvent()
DBE dbeMyField = some sort of canvas declaration
hasInPlace(dbeMyField, clbkCanvasEvent) // Associate Events on the Canvas with the Callback
Thanks for your answer. I understand how to use it, I have tried something like that but without the "InPlaceEditEvent", it was not working. But I have another question... The hasInPlace function could be used only on canvas, actually I use a "field" to get a text editor, and I can't trigger update function for each modification of the "field". I think I must not use the "field" but use a "canvas" declared as an inPlace Editor (that way, caracters could be enterred in canvas area, and function is called for each update), but I don't know how to do that... Do you know how to declared a canvas as an editable text area? Thanks for your help JLacroix |
Re: how to use function "hasInPlace" jlacroix - Wed Nov 04 09:01:03 EST 2009
Hello,
void clbkCanvasRepaint(DBE dbeCanvas) {
// nothing needed yet
}
void clbkCanvasEvent(DBE dbeCanvas, InPlaceEditEvent Event)
{ if (Event == inPlaceTextFilled)
{ print "Size changed. Size:" (inPlaceTextHeight dbeCanvas) "\n"
}
elseif (Event == inPlaceTextChange)
{ print "Text changed. Text:" (string inPlaceGet (dbeCanvas, inPlaceText)) "\n"
}
else
{ print "Never happens (I hope!)\n"
}
} // end clbkCnavasEvent()
DB db = create "Example"
DBE dbeMyRichCanvas = canvas (db,100,100,clbkCanvasRepaint)
hasInPlace(dbeMyRichCanvas, clbkCanvasEvent) // Associate Events on the Canvas with the Callback
realize db
inPlaceMove (dbeMyRichCanvas, inPlaceText, 0,0,100,100)
inPlaceSet (dbeMyRichCanvas, inPlaceText, "Hello World")
show db
|
Re: how to use function "hasInPlace" jlacroix - Wed Nov 04 09:01:03 EST 2009 |
Re: how to use function "hasInPlace" ePiallat - Wed Nov 04 10:19:49 EST 2009
Hello,
void clbkCanvasRepaint(DBE dbeCanvas) {
// nothing needed yet
}
void clbkCanvasEvent(DBE dbeCanvas, InPlaceEditEvent Event)
{ if (Event == inPlaceTextFilled)
{ print "Size changed. Size:" (inPlaceTextHeight dbeCanvas) "\n"
}
elseif (Event == inPlaceTextChange)
{ print "Text changed. Text:" (string inPlaceGet (dbeCanvas, inPlaceText)) "\n"
}
else
{ print "Never happens (I hope!)\n"
}
} // end clbkCnavasEvent()
DB db = create "Example"
DBE dbeMyRichCanvas = canvas (db,100,100,clbkCanvasRepaint)
hasInPlace(dbeMyRichCanvas, clbkCanvasEvent) // Associate Events on the Canvas with the Callback
realize db
inPlaceMove (dbeMyRichCanvas, inPlaceText, 0,0,100,100)
inPlaceSet (dbeMyRichCanvas, inPlaceText, "Hello World")
show db
Thanks, that's exactly what I was looking for. I understand now: a canvas is a box, and the text editor is only an area of this box, like a rectangle or a picture. But I have a trouble with your function: The trigger on event "inPlaceTextChange" doesn't work. In your example, the text "Hello World" is displayed, if with your mouse you select the "o" letter and replace it with a "a", then text displayed is "Hello Warld" and no event was triggered. This is perhaps linked to my version od Doors, I use the 8.1.0.8 Thanks again for your support. JLacroix |
Re: how to use function "hasInPlace" jlacroix - Thu Nov 05 04:25:30 EST 2009 |